package sort;

import java.util.Arrays;

public class InsertSort {
	public static void main(String[] args) {
		int[]  arr = {19,2,44,67,23,11,3,6,1};
		insertSort(arr);
	}

	public static void insertSort(int[] arr){

		int j = 0;
		int k = arr.length;
		for (int i = 0; i < k; i++) {
				int tmp = arr[i];
			for ( j = i; j >0 && tmp < arr[j-1]; j--) {
				arr[j] =arr[j-1];
			}
			arr[j] = tmp;
		}
		Arrays.stream(arr).forEach(t-> System.out.print(t+" "));
	}
}
